<b>A/R Statements</b>
<script>
    $(document).ready(function(){
        $('.openHiddenRow').parent().parent().next().hide();
        $('.openHiddenRow').click(function(){
            $(this).parent().parent().next().toggle();
        })
    })
</script>
<br/>
<?php
/* @var $model Customers */

$table=new CI_Table();
$table->set_template(array(
    'table_open'=>'<table width="300">',
       'cell_alt_start'=> '<td aligh="right">',
));
$table->add_row('<div class="openHiddenRow">Open Invoices</div>',  number_format($openInvoice,2));
$table->add_row('&nbsp',array(
    'data'=>$this->renderPartial('_openInvoiceList',array(
        'invoiceList'=>$openInvoiceList
    ),true)
));

$table->add_row('<div class="openHiddenRow">Credit</div>',number_format(-$credit,2));
$table->add_row('&nbsp',array(
    'data'=>$this->renderPartial('_openInvoiceList',array(
        'invoiceList'=>$creditInvoiceList
    ),true)
));

$table->add_row('<div class="openHiddenRow">Credit Memo</div>',  number_format($creditMemoAmount,2));
$table->add_row('&nbsp',array(
    'data'=>$this->renderPartial('_openInvoiceList',array(
        'invoiceList'=>$creditMemoList
    ),true)
));

$table->add_row('<b>A/R : Sub-Totals</b>',number_format($subTotal,2));

$table->add_row('<div class="openHiddenRow">Deposit/PP</div>',number_format(-$pp,2));
$table->add_row('&nbsp',array(
    'data'=>$this->renderPartial('_openInvoiceList',array(
        'invoiceList'=>$depositInvoiceList
    ),true)
));
$table->add_row('<b>A/R : Total</b>',number_format($total,2));
echo $table->generate();
?>